package com.black.opsapi.feign;

import com.black.opsapi.feign.factory.RemoteRoleServiceFallbackFactory;
import com.black.opscommon.constant.SecurityConstants;
import com.black.opscommon.constant.ServiceNameConstants;
import com.black.opscommon.entity.Role;
import com.black.opscommon.utils.R;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestHeader;

import java.util.Set;

/**
 * @author qiang.zhang
 * @date 2019/2/1
 */
@FeignClient(value = ServiceNameConstants.UMPS_SERVICE, fallbackFactory = RemoteRoleServiceFallbackFactory.class)
public interface RemoteRoleService {
	/**
	 * 通过roleId 查询对应的角色信息
	 *
	 * @param roleId   角色id
	 * @param from     调用标志
	 * @return R
	 */
	@GetMapping("/api/roles/{roleId}")
	R<Set<Role>> findByUsers_Id(@PathVariable("roleId") Long roleId
            , @RequestHeader(SecurityConstants.FROM) String from);

}
